package com.example.listossimage.controller;

import com.example.listossimage.service.ImageOssService;
import com.example.listossimage.vo.GetThirdPartyPayQRCodeVo;
import com.example.listossimage.vo.QrCodeVo;
import com.example.listossimage.vo.ResponseVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private ImageOssService imageOssService;


    @RequestMapping(value = "/1", method = RequestMethod.GET)
    public String test() throws Exception {
        for (int i = 0; i < 1000; i++) {
            imageOssService.test(i);
            Thread.sleep(100);
        }
        return "";
    }

    @PostMapping("/payQr")
    public ResponseVo getThirdPartyPayQRCode(@RequestBody @Valid GetThirdPartyPayQRCodeVo partyPayQRCodeVo) {
        ResponseVo responseVo = ResponseVo.newInstanceOK();
        QrCodeVo vo = new QrCodeVo();
        vo.setQrcode("http://www.baidu.com");
        responseVo.setData(vo);
        responseVo.setMessage("成功！");
        return responseVo;
    }

}
